#version 110

uniform sampler2D DiffuseSampler;
uniform sampler2D SecondSampler;
uniform sampler2D FirstSampler;
uniform vec2 InSize;

varying vec2 texCoord;
varying vec2 oneTexel;

float border_x = 16.0;//distance from button
float border_y = 16.0;//distance from left side
float width = 128.0;//picture display width (regardless of picture width)
float height = 128.0;//picture display height, same as width
float alpha_limit = 0.1;//determines whether the transparent part of the image is rendered

void main()
{
    vec2 Pos = texCoord * InSize;
    gl_FragColor = texture2D(FirstSampler, texCoord);
    
    vec4 color = texture2D(SecondSampler, abs( vec2(0.0,1.0) - (Pos - vec2(border_x,border_y) ) / vec2(width,height) ) );
    if(Pos.x < (width + border_x) && Pos.y < (height + border_y) && color.a > alpha_limit){
        if(Pos.x > border_x && Pos.y > border_y)gl_FragColor = color;
    }    
}